
// Globals are declared outside all other scopes.
pub static LANGUAGE: &'static str = "Rust";
pub const  THRESHOLD: i32 = 10;

fn is_big(n: i32) -> bool {
    // Access constant in some function
    n > THRESHOLD
}

pub fn constants_test() {
    let n = 16;

    // Access constant in the main thread
    println!(" ==> This is {}", LANGUAGE);
    println!(" ==> The threshold is {}", THRESHOLD);
    println!(" ==> {} is {} than {}", n, if is_big(n) { "big" } else { "small" }, THRESHOLD);

    // Error! Cannot modify a `const`.
    println!(" Error! Cannot modify a `const`: THRESHOLD = 5;");
    // FIXME ^ Comment out this line
}
